﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Drawing;

namespace BaseHelper.Base
{
    public class IconHelper
    {
        private static string folder;
        private static string fix;
        private static string ext;


        public static bool Init(string Folder, string Fix = "icon",string Ext=".png")
        {
            folder = Folder;
            fix = Fix;
            ext = Ext;
            if (folder.Length > 0 && folder.Substring(folder.Length - 1, 1) != "\\")
                folder += "\\";
            return File.Exists(folder);
        }

        public static Image LoadIco(string FileName)
        {
            try
            {
                string filePath = folder + fix + FileName + ext;

                if (File.Exists(filePath))
                {
                    return Image.FromFile(filePath);
                }
            }
            catch { }
            return null;
        }
    }
}